package edu.cuit.avatar;

/**
 * @author <a href="mailto:1020zhaodan@163.com">Adan</a>
 * @version 1.0
 * @date 2025/7/18 15:19
 */
public class Student {
    private int id;
    private static int nextId = 1;
    //实例变量
    private String name;
    private String major;

    private String gender;

    public Student() {
        this.id = nextId++;
    }

    public Student(String name, String major) {
        this();
        this.name = name;
        this.major = major;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    //实例方法
    public void study(){
        System.out.println(name + "正在努力学习" + major);
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", major='" + major + '\'' +
                '}';
    }
}
